<template>
  <div class="hy-breadcrumb">
    <el-breadcrumb separator="/" v-if="breadcrumbs && breadcrumbs.length">
      <template v-for="(item, i) in breadcrumbs" :key="i">
        <el-breadcrumb-item
          v-if="
            breadcrumbs && breadcrumbs.length && i !== breadcrumbs.length - 1
          "
          :to="{ path: item.path }"
          >{{ item.name }}</el-breadcrumb-item
        >
        <el-breadcrumb-item v-else>{{ item.name }}</el-breadcrumb-item>
      </template>
    </el-breadcrumb>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import type { IBreadcrumb } from '../types'
export default defineComponent({
  name: 'HyBreadcrumb',
  props: {
    breadcrumbs: {
      type: Array as PropType<IBreadcrumb[]>
    }
  },
  setup() {
    return {}
  }
})
</script>

<style lang="less" scoped></style>
